from django.db import models

class Tbpathway(models.Model):
    pathid = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=200)
    def __str__(self):
      return self.name
    class Meta:
        db_table = u'tbpathway'
    class Admin:
        # Admin options go here
        list_display = ('pathid', 'name',  )
        ordering = ('pathid',)
        search_fields = ('name',)         

class Tbcompound(models.Model):
    compoundid = models.CharField(max_length=6, primary_key=True)
    name = models.CharField(max_length=300, blank=True)
    def __str__(self):
      return self.name
    class Meta:
        db_table = u'tbcompound'


class Tbmet_link(models.Model):
    com1 = models.ForeignKey(Tbcompound, related_name = "sub")
    com2 = models.ForeignKey(Tbcompound, related_name = "pro")
    rea=models.CharField(max_length=200)
    pathway=models.ForeignKey(Tbpathway)
#    def __unicode__(self):
#      return u'%s %s' (self.gene, self.enzyme)
    class Meta:
        db_table = u'tbmet_link'
    class Admin:
        list_display = ('com1', 'com2','rea',)
        list_per_page = 100
        ordering = ('com1',)
        search_fields = ('com1','com2','rea',)         

